<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>任务管理系统</title>
<link href="${pageContext.request.contextPath }/BootStrapUI/login/style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="${pageContext.request.contextPath }/BootStrapUI/login/jquery.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/BootStrapUI/login/cloud.js"></script>

<script language="javascript">
	$(function(){
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
	$(window).resize(function(){  
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
    })  
});  
</script> 
<script type="text/javascript">
	function resetErr() {
		$("#nameerr").hide();
		$("#nameerr").html("");
	}

	function login() {


		resetErr();
		if ($("#scode").val() == "" || $("#scode").val() == undefined
				|| $("#pass").val() == ""
				|| $("#pass").val() == undefined) {
			$("#nameerr").show();
			$("#nameerr").text("用户名或密码不得为空！");
		} else {
		$.ajax({
	            type: "POST",
	            url:"${pageContext.request.contextPath}/login/login.do",
	            data:$('#loginform').serialize(),// 你的formid
	            success: function(data) {
	            	if (data == 0) {
						$("#nameerr").show();
						$("#nameerr").html("用户名或者密码不正确！");
					}else {

						$("#login").attr("disabled", true); 
						/*$.ajax({
								type : "POST",
								url : "${pageContext.request.contextPath}/login/loginTo.do",
								success : function(data) {
									window.location.href = data+ ".jsp";
								}
						});*/

                        window.location.href = "${pageContext.request.contextPath}/loginToke.do";
					}
	            }
	        }); 
		}
	}
</script>
</head>
<body style="background-color:#1c77ac; background-image:url(${pageContext.request.contextPath }/css/login/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">

    <div id="mainBody">
      <div id="cloud1" class="cloud"></div>
      <div id="cloud2" class="cloud"></div>
    </div>  

<div class="logintop">    

    </div>
    
    <div class="loginbody">
    	
   		<span class="systemlogo"></span> 
    
  		 	<div class="loginbox">
   
		    <ul>
		    	<form id="loginform" class="form form-horizontal" action="#" method="post">
				    <li><input id="scode" name="scode"  type="text" class="loginuser" placeholder="输入员工编号"/></li>
				    <li><input id="pass" name="pass" type="password" class="loginpwd" placeholder="输入密码"/></li>

				 </form>
			    <div id="nameerr" style="color: red; margin-left: 90px;margin-bottom: 10px; ">


				</div>

				<li style="padding-left: 100px;"><input id="login" onclick="login()"  type="submit" class="loginbtn" value="登录"/></li>
		    </ul>
   		</div>
    </div>
    
    <div class="loginbm">Copyright ©2018 北京盛达融元西安研发中心</div>
</body>

</html>
